import request from "@/api/index"

export default{
  /**
   * @description: 添加数据项 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
   add(params){
    const url = "/iot/dataItem/add"
    return request.post(url,{
      homeBaseId:sessionStorage.getItem("homeBaseId"),
      homeBaseType:sessionStorage.getItem("homeBaseType"),
      ...params
    })
  },
  /**
   * @description: 编辑数据项 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
   edit(params){
    const url = "/iot/dataItem/edit"
    return request.post(url,{
      homeBaseId:sessionStorage.getItem("homeBaseId"),
      homeBaseType:sessionStorage.getItem("homeBaseType"),
      ...params
    })
  },
  /**
   * @description: 批量删除数据项 *代表必填
   * @param {String/Number} id *
   * @return {Object}
   */
  delListById(params){
    const url = "/iot/dataItem/delListById"
    return request.get(url,params)
  },
  /**
   * @description: 单个删除数据项 *代表必填
   * @param {String/Number} id *
   * @return {Object}
   */
   delById(params){
    const url = "/iot/dataItem/delById"
    return request.get(url,params)
  },
  /**
   * @description: 条件查询 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
  queryByCondition(params){
    const url = "/iot/dataItem/queryByCondition"
    return request.post(url,{
      homeBaseId:sessionStorage.getItem("homeBaseId"),
      homeBaseType:sessionStorage.getItem("homeBaseType"),
      ...params
    })
  },
  /**
   * @description: 分页查询数据项 *代表必填
   * @param {Object} params *
   * @param {String/Number} page *
   * @param {String/Number} size *
   * @return {Object}
   */
   queryPageByCondition(params){
    const url = "/iot/dataItem/queryPageByCondition"
    return request.post(url,{
      homeBaseId:sessionStorage.getItem("homeBaseId"),
      homeBaseType:sessionStorage.getItem("homeBaseType"),
      ...params
    })
   },

// ----------------其他物联接口---------------------------

  /**
   * @description: 查询气象站 *代表必填
   * @param null *
   * @return {Object}
   */
  queryMeteorologicalRtuList(params){
    const url = "/iot/iotPlatform/rtu/queryMeteorologicalRtuList"
    return request.get(url,params)
  },
  /**
   * @description: 查询所属数据项接口 *代表必填
   * @param {Number} rtuId*
   * @return {Object}
   */
  queryByRtuId(params){
    const url = "/iot/iotPlatform/dataItem/queryByRtuId"
    return request.get(url,params)
  },
  /**
   * @description: 获取当前基地所有数据项列表 *代表必填
   * @param {String/Number} page
   * @param {String/Number} size
   */
  queryDataItemByCompanyMark(params) {
    return request.get('iot/iotPlatform/queryDataItemByCompanyMark',{
      companyMark:sessionStorage.getItem('companyMark')
    })
  },
}